package br.com.dataphonebr;

import br.com.dataphonebr.adapter.AppointmentAdapter;
import br.com.dataphonebr.entity.Atividade;
import br.com.dataphonebr.service.AtividadeService;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

public class AppointmentListActivity extends GenericActivity<Atividade> {
	
	private AtividadeService atividadeService;
	
	public AppointmentListActivity() {
		super(Atividade.class);
	}

	AppointmentAdapter adapter;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_appointment_list);
	}
	
	@Override
	public void init(){
		atividadeService = new AtividadeService(this);
		setServiceInstance(atividadeService);
		super.init();
	}
	
	public void addAppointmentOnClick(View v){
		openView(AppointmentListActivity.this, AppointmentActivity.class, true);
		setId(null);
	}
	
	@Override
	public void prepareComponents() {
		ListView listView = (ListView) findViewById(R.id.appointmentListView);
		listView.setAdapter(adapter);		
	}

}
